<template>
  <div>
    <div id="app">
      <table width="60%" border="0" cellpadding="0" cellspacing="1">
        <tbody>
          <tr></tr>
          <tr>
            <td height="20" align="middle" bgcolor="#f3f3f3">单位名称</td>
            <td height="20" bgcolor="#f3f3f3">
              <div align="left">
                <input
                  id="unit.unitname"
                  v-model="unit.unitname"
                  name="unit.unitname"
                />
              </div>
            </td>
          </tr>
          <tr>
            <td height="20" align="middle" bgcolor="#f3f3f3">单位地址</td>
            <td height="20" bgcolor="#f3f3f3">
              <div align="left">
                <input
                  id="unit.address"
                  v-model="unit.address"
                  name="unit.address"
                />
              </div>
            </td>
          </tr>
          <tr>
            <td height="20" align="middle" bgcolor="#f3f3f3">单位法人</td>
            <td height="20" bgcolor="#f3f3f3">
              <div align="left">
                <input
                  id="unit.corporation"
                  v-model="unit.corporation"
                  name="unit.corporation"
                />
              </div>
            </td>
          </tr>
          <tr>
            <td height="20" align="middle" bgcolor="#f3f3f3">注册资金</td>
            <td height="20" bgcolor="#f3f3f3">
              <div align="left">
                <input
                  id="unit.investment"
                  v-model="unit.investment"
                  name="unit.investment"
                />
              </div>
            </td>
          </tr>
          <tr>
            <td height="20" align="middle" bgcolor="#f3f3f3">单位性质</td>
            <td height="20" bgcolor="#f3f3f3">
              <div align="left">
                <input id="unit.type" v-model="unit.type" name="unit.type" />
              </div>
            </td>
          </tr>
          <tr>
            <td height="20" align="middle" bgcolor="#f3f3f3">单位电话</td>
            <td height="20" bgcolor="#f3f3f3">
              <div align="left">
                <input id="unit.tel" v-model="unit.tel" name="unit.tel" />
              </div>
            </td>
          </tr>
          <tr>
            <td height="20" align="middle" bgcolor="#f3f3f3">单位邮箱</td>
            <td height="20" bgcolor="#f3f3f3">
              <div align="left">
                <input id="unit.email" v-model="unit.email" name="unit.email" />
              </div>
            </td>
          </tr>
          <tr>
            <td height="20" align="middle" bgcolor="#f3f3f3">单位传真</td>
            <td height="20" bgcolor="#f3f3f3">
              <div align="left">
                <input id="unit.fax" v-model="unit.fax" name="unit.fax" />
              </div>
            </td>
          </tr>
          <tr>
            <td height="20" align="middle" bgcolor="#f3f3f3">单位邮编</td>
            <td height="20" bgcolor="#f3f3f3">
              <div align="left">
                <input
                  id="unit.zipcode"
                  v-model="unit.zipcode"
                  name="unit.zipcode"
                />
              </div>
            </td>
          </tr>
          <tr>
            <td align="middle" bgcolor="#f3f3f3">单位简介</td>
            <td bgcolor="#f3f3f3">
              <div align="left">
                <textarea
                  id="textarea"
                  name="unit.introduction"
                  rows="5"
                  cols="40"
                  v-model="unit.introduction"
                ></textarea>
              </div>
            </td>
          </tr>
          <tr>
            <td height="30" colspan="2" align="middle" bgcolor="#f3f3f3">
              <input
                id="submit3"
                type="button"
                @click="updateUnit"
                value="修改"
                name="submit7"
              />
              <input id="button23" type="reset" value="取消" name="button23" />
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <div id="container">
      <div id="footer">
        <p>
          <a href="http://www.ascenttech.com.cn/" target="_blank"
            >版权所有：北京亚思晟商务科技有限公司
            &copy;2004-2008|京ICP备05005681</a
          >
        </p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
    data:function() {
return {
      unit:{
        uid: "",
        unitname: "",
        address: "",
        corporation: "",
        investment: "",
        type: "",
        tel: "",
        email: "",
        fax: "",
        zipcode: "",
        introduction: ""
      },

    };
},
    mounted()
    {
      this.unit=JSON.parse(localStorage.getItem("unit"));
      console.log(this.unit);
    },
    methods:{
      updateUnit:function ()
      {
        this.$axios.post(
                "http://localhost:8080/api/unitmessage",
                this.unit
        )
                .then((resp)=>{
                  console.log(resp.data.code+" "+resp.data.msg);
                  location.href="/declare/admin/showUnits";
                })
      }
    }

};
</script>

<style>
</style>